<template>
  <div class="commodity-card">
    <div class="show-img">
      <img src="@/assets/Bitmap@3x.png" alt="" />
    </div>
    <div class="commodity-title">{{ product.name }}</div>
    <div class="clear-empty-margin">
      <span class="commodity-tag">免押金</span>
    </div>
    <div class="commodity-price">
      <div class="price">
        ￥
        <span>{{ maxFont }}</span>
        {{ minFont }}/天
      </div>
      <div class="explain">30天起租</div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import { ProductType } from '@/views/home-page/init-data-types'

interface PropsType {
  product: ProductType
}

const props = defineProps<PropsType>()
const maxFont = computed(() => props.product.price.slice(0, 1))
const minFont = computed(() => props.product.price.slice(1, 4))
function requestInfomasion<T>(arg:T):T{
  return arg
}
requestInfomasion(123)

</script>

<style lang="scss" scoped>
.clear-empty-margin {
  line-height: 18px;
  height: 18px;
}
.commodity-card {
  display: inline-block;
  width: 170px;
  height: 212px;
  margin: 10px 0 0 12px;
  overflow: hidden;
  background: #fff;
  border-radius: 6px;
  .show-img {
    overflow: hidden;
    width: 170px;
    height: 142px;
    img {
      width: 170px;
      height: 150px;
      transform: scale(1.3);
    }
  }

  .commodity-title {
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
    font-size: 15px;
    line-height: 18px;
    padding: 0 10px;
  }
  .commodity-tag {
    display: inline-block;
    border-radius: 2px;
    border: 0.5px solid #00c8be;
    padding: 0.5px 4.5px;
    color: #00c8be;
    font-size: 11px;
    line-height: 15px;
    margin-left: 10px;
  }
  .commodity-price {
    line-height: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 6px 8.5px;

    .price {
      color: #f04f4f;
      font-size: 12px;
      line-height: 25px;
      span {
        font-size: 18px;
      }
    }
    .explain {
      color: #aaaaaa;
      font-size: 12px;
    }
  }
}
</style>
